package com.sgb.kjwl.view.ui.adapter.enterprise;

import android.content.Context;
import android.view.View;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ItemMakeOverPublishMainCopyrightBinding;
import com.sgb.kjwl.databinding.ItemMakeOverPublishMainPatentBinding;
import com.sgb.kjwl.interfaces.PublishRecyclerClick;
import com.sgb.kjwl.model.entity.enterprise.CompanyPublishEntity;
import com.sgb.kjwl.model.entity.enterprise.CopyrightPublishEntity;
import com.sgb.kjwl.model.entity.enterprise.TrademarkPublishEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class CopyrightPublishAdapter extends BaseRecycleAdapter<CopyrightPublishEntity> {

    PublishRecyclerClick<CopyrightPublishEntity> mPublishEntityPublishRecyclerClick;
    ItemMakeOverPublishMainCopyrightBinding mBind;

    public void setmPublishEntityPublishRecyclerClick(PublishRecyclerClick<CopyrightPublishEntity> mPublishEntityPublishRecyclerClick) {
        this.mPublishEntityPublishRecyclerClick = mPublishEntityPublishRecyclerClick;
    }

    public CopyrightPublishAdapter(Context context, List<CopyrightPublishEntity> datas) {
        super(context, R.layout.item_make_over_publish_main_copyright, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, CopyrightPublishEntity talentEntity) {
        holder.setBinding(BR.entity, talentEntity);
        mBind = (ItemMakeOverPublishMainCopyrightBinding) holder.getmBinding();
        holder.getItem().findViewById(R.id.tv_item_make_over_publish_main_up_and_down).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mPublishEntityPublishRecyclerClick.recyclerClick(talentEntity);
            }
        });

        if (null==talentEntity.getOrderStatus()||"3".equals(talentEntity.getOrderStatus())){
            mBind.tvItemMakeOverPublishMainUpAndDown.setVisibility(View.VISIBLE);
            mBind.imgSbStatus.setImageDrawable(context.getResources().getDrawable(R.mipmap.icon_zai_shou_zhong));
        }else if("1".equals(talentEntity.getOrderStatus())||"2".equals(talentEntity.getOrderStatus())||"4".equals(talentEntity.getOrderStatus())){
            mBind.tvItemMakeOverPublishMainUpAndDown.setVisibility(View.GONE);
            mBind.imgSbStatus.setImageDrawable(context.getResources().getDrawable(R.mipmap.icon_jiaoyizhong));
        }else if ("5".equals(talentEntity.getOrderStatus())){
            mBind.tvItemMakeOverPublishMainUpAndDown.setVisibility(View.GONE);
            mBind.imgSbStatus.setImageDrawable(context.getResources().getDrawable(R.mipmap.icon_yichushou));
        }
    }
}